# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=omxplayer
pkgver=0.20190102
_commitid=f06235cc9690a6d58187514452df8cf8fcdaacec
pkgrel=11
pkgdesc="Commandline OMX player for Raspberry Pi"
url="https://github.com/popcornmix/omxplayer"
arch="armhf armv7"
license="GPL-2.0"
depends="font-freefont"
makedepends="linux-headers raspberrypi-dev>=0.20181212 ffmpeg4-dev pcre-dev
	boost-dev freetype-dev dbus-dev alsa-lib-dev"
options="!check"
subpackages="$pkgname-doc $pkgname-dbg $pkgname-openrc"
source="omxplayer-$pkgver.tar.gz::https://github.com/popcornmix/omxplayer/archive/$_commitid.tar.gz
	issue-260.patch
	issue-297.patch
	fix-makefile.patch
	default-font.patch

	omxplayer.initd
	omxplayer.confd
	"

builddir="$srcdir"/$pkgname-$_commitid

build() {
	cat <<-EOF > Makefile.include
	INCLUDES:=-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux
	INCLUDES+=$(pkg-config --cflags freetype2 dbus-1)
	LDFLAGS:=-L/opt/vc/lib -Wl,-rpath,/opt/vc/lib
	LIBS:=$(pkg-config --libs freetype2 dbus-1)
	STRIP:=echo
	EOF
	make omxplayer.bin
}

package() {
	mkdir -p $pkgdir/usr/bin $pkgdir/usr/share/doc/omxplayer
	cp omxplayer.bin $pkgdir/usr/bin/omxplayer
	cp COPYING $pkgdir/usr/share/doc/omxplayer
	cp README.md $pkgdir/usr/share/doc/omxplayer/README

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="
8ed9714c8dd7de7bdeeaefd4f37dbf2840899e9a289cb18080750c93b878ef01a04c141eaf86d2cfae0b999bcc8e080ac1aac0930d55440c6e4d02e3b0eb93b2  omxplayer-0.20190102.tar.gz
c349eea5f7c513a07d82a6cf6467c4d21bcb29c053bc5e39d8f675b1212db9beef0abf5248d50ac5a2f14fda73055786f94f421377ffcf5f6bcf8daa2f1b56e8  issue-260.patch
2a8a6def1e09f726cba58c0b9109fa6c4fbd4a3b4f1d27d200488f262a0e0978579d83db7fe24f1d3e03beef318c3674ed79cbd2f1994c4551a59c9fe0f63489  issue-297.patch
3493d9600fda75a7599fada332c48e8790dcc46ada65b862bb14dafb701dd7ed89f3debf439160917b73d779f549898146b394e13c45dc7d77122a11a2ede97e  fix-makefile.patch
8aa58aaa07453186302dc68d92f28c1b50bf0f8fccd50359640a7fc8339b233b32a0c8c02284a9974599e56d69cc557acc25e76e6438c6d64d15afd9c1788a8e  default-font.patch
a6ce3f69960d8f6234438dcf981f54bdeef32f14aeb5ce7c8cb889806a2e8938512423e915f63e5a27206383b5f4741898622dfb36b88411c6b20a44036bd63a  omxplayer.initd
4f906ada035869a0e515e7615056b18b0f6906ce4b3a2d34081c0efa79bb9455380f729e7c5270180f5ace89c53a7ac7c93f609e6761825f639f44aa22346bb2  omxplayer.confd
"
